package com.gedeshidai.shumadevelop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gedeshidai.shumadevelop.common.BaseResponse;
import com.gedeshidai.shumadevelop.model.entity.History;
import com.gedeshidai.shumadevelop.service.HistoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/history")
public class HistoryController {

    @Autowired
    private HistoryService historyService;

    /**
     * 商品操作历史查询
     * @param productId
     * @param currentPage
     * @param pageSize
     * @return
     */

    @GetMapping("/page")
    public BaseResponse<Page<History>> getHistoryPageById(
            @RequestParam Long productId,
            @RequestParam(defaultValue = "1") int currentPage,
            @RequestParam(defaultValue = "10") int pageSize
    ) {
        return historyService.getHistoryPageById(productId, currentPage, pageSize);
    }
}
